<?php /*a:3:{s:68:"D:\projects\original_admin\app\merchant\view\store\store_notice.html";i:1754816634;s:61:"D:\projects\original_admin\app\merchant\view\common\base.html";i:1752764603;s:63:"D:\projects\original_admin\app\merchant\view\common\header.html";i:1754830154;}*/ ?>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8" />
	<meta name="renderer" content="webkit" />
	<meta name="force-rendering" content="webkit" />
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>管理系统</title>
	<script src="/static/merchant/js/jquery-min.js"></script>
	<link rel="stylesheet" href="/static/merchant/layui/css/layui.css">
	<script type="text/javascript" src="/static/merchant/layui/layui.js"></script>
	<link rel="stylesheet/less" type="text/css" href="/static/merchant/css/index.less" />
	<script src="/static/merchant/js/less.js"></script>
    
</head>
<body>
	<main class="CenterMain">
		<header class="Header">
    <div class="logo img_box">
        <img src="/static/merchant/images/logow.png">

    </div>
    <div class="top">
        <ul class="nav-buttons">
            <li id="toggle-btn">

                <span class="desktop-text layui-icon layui-icon-spread-left">
                </span>
                <span class="mobile-text">菜单</span>
            </li>
        </ul>
        <dl class="menu-btn">
            <a class="img_box ">
                <img src="/static/merchant/images/head1.png">
                <i class="msg"></i>
            </a>
            <a class="img_box">
                <img src="/static/merchant/images/head2.png">
            </a>
        </dl>
        <span class="hr"></span>
        <ul class="layui-nav">

            <li class="layui-nav-item" lay-unselect>
                <a href="javascript:;">
                    <img  src="<?php echo htmlentities((string) (isset($userInfo['shop_thumb']) && ($userInfo['shop_thumb'] !== '')?$userInfo['shop_thumb']:'/static/merchant/images/sign-user.png')); ?>" class="layui-nav-img">
                    <span><?php echo htmlentities((string) $userInfo['shop_name']); ?></span>
                </a>
                <dl class="layui-nav-child">
                    <!-- <dd><a href="account_info.html">个人信息</a></dd> -->
                    <dd><a href="/merchant/account_pwd.html">密码修改</a></dd>
                    <dd style="text-align: center;"><a href="/merchant/login_out">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>

</header>
<div class="Sidebar" id="sidebar">
    <ul class="menu">
        <li class="menu-item">
            <div lay-on="url" href="/" class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav22.png">
                    <img class="img2" src="/static/merchant/images/nav21.png">
                </div>
                <span>商品管理</span>
                <!-- <i class="layui-icon layui-icon-right"></i> -->
            </div>
        </li>
        <li class="menu-item <?php if($routers == 'order/list' || $routers == 'order/shop_back' || $routers == 'order/review'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav32.png">
                    <img class="img2" src="/static/merchant/images/nav31.png">
                </div>
                <span>订单管理</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>
            <dl    <?php if($routers == 'order/list' || $routers == 'order/shop_back' || $routers == 'order/review'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?> >
                <dd>
                    <a href="/merchant/order.html"  <?php if($routers == 'order/list'): ?>  class="active" <?php endif; ?> >订单管理</a>
                </dd>
                <dd>
                    <a href="/merchant/shop_back.html" <?php if($routers == 'order/shop_back'): ?>  class="active" <?php endif; ?>>退货管理</a>
                </dd>
                <dd>
                    <a href="/merchant/review.html" <?php if($routers == 'order/review'): ?>  class="active" <?php endif; ?>>订单评价</a>
                </dd>

            </dl>

        </li>
        <li class="menu-item <?php if($routers == 'finance/finance_cash' || $routers == 'finance/finance_account' || $routers == 'finance/finance_log' || $routers == 'finance/finance_logs'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav42.png">
                    <img class="img2" src="/static/merchant/images/nav41.png">
                </div>
                <span>财务提现</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

            <dl  <?php if($routers == 'finance/finance_cash' || $routers == 'finance/finance_account' || $routers == 'finance/finance_log' || $routers == 'finance/finance_logs'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?>>
                <dd>
                    <a  <?php if($routers == 'finance/finance_cash'): ?>  class="active" <?php endif; ?> href="/merchant/finance_cash.html">提现</a>
                </dd>
                <dd>
                    <a  <?php if($routers == 'finance/finance_logs'): ?>  class="active" <?php endif; ?> href="/merchant/finance_logs.html">记录</a>
                </dd>
            </dl>

        </li>
        <!-- <li class="menu-item ">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="images/nav52.png">
                    <img class="img2" src="images/nav51.png">
                </div>
                <span>消息中心</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

        </li> -->
        <li class="menu-item <?php if($routers == 'store/store_info' || $routers == 'store/store_notice' || $routers == 'store/store_model'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav62.png">
                    <img class="img2" src="/static/merchant/images/nav61.png">
                </div>
                <span>店铺设置</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

            <dl <?php if($routers == 'store/store_info' || $routers == 'store/store_notice' || $routers == 'store/store_model'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?>>
                <dd>
                    <a  <?php if($routers == 'store/store_info'): ?>  class="active" <?php endif; ?> href="/merchant/store_info.html">店铺信息 </a>
                </dd>
                <dd>
                    <a <?php if($routers == 'store/store_notice'): ?>  class="active" <?php endif; ?> href="/merchant/store_notice.html">店铺公告</a>
                </dd>
                <dd>
                    <a <?php if($routers == 'store/store_model'): ?>  class="active" <?php endif; ?>  href="/merchant/store_model.html">运费模板</a>
                </dd>
            </dl>

        </li>
    </ul>
</div>
		 
<div class="Content" id="content">
    <div class="container">
        <form class="layui-form search-form SearchCom" lay-filter="searchForm">
            <a lay-on="addNotice" class="layui-btn layui-btn-normal">
                <i class="layui-icon layui-icon-add-circle"></i>添加公告
            </a>
        </form>
        <table class="layui-hide" id="noticeTable" lay-filter="noticeTable"></table>
    </div>
</div>

<script type="text/html" id="operateTpl">
    <div class="foot">
        <a class="btn-delete" lay-event="delete">删除</a>
    </div>
</script>

<script type="text/html" id="contentTpl">
    <div style="padding: 10px; word-break: break-all;">{{ d.content }}</div>
</script>


	</main>
</body>
<script  src="/static/merchant/js/index.js"></script>
<script src="/static/merchant/js/base.js"></script>
 
<script>
    changeTitleName('店铺公告');
    
    layui.use(['table', 'layer', 'form', 'util'], function () {
        var table = layui.table;
        var layer = layui.layer;
        var form = layui.form;
        var util = layui.util;
        var $ = layui.$;

        // 渲染表格
        table.render({
            elem: '#noticeTable',
            url: "/merchant/get_store_notice", // 数据接口
            cols: [[
                { field: 'content', title: '内容', templet: '#contentTpl', minWidth: 300 },
                { field: 'create_time', title: '发布时间', width: 180, sort: true },
                { 
                    title: '操作',
                    toolbar: '#operateTpl', 
                    width: 100,
                    align: 'center'
                }
            ]],
            page: true,
            limit: 10,
            limits: [10, 20, 30],
            text: {
                none: '暂无公告数据'
            }
        });
        util.on({
                //点击跳转url
                addNotice: function () {
                    layer.open({
                        type: 1,
                        title: '添加公告',
                        content: '<div style="padding: 20px;">' +
                                '<textarea id="noticeContent" placeholder="请输入公告内容" style="width: 100%; height: 150px; padding: 10px;" class="layui-textarea"></textarea>' +
                                '</div>',
                        area: ['600px', '300px'],
                        btn: ['确定', '取消'],
                        btnAlign: 'c',
                        yes: function(index, layero) {
                            var content = $('#noticeContent').val().trim();
                            if (!content) {
                                layer.msg('请输入公告内容', {icon: 2});
                                return;
                            }
                            
                            // 显示加载中
                            var loadIndex = layer.load(2);
                            
                            // 提交到后台
                            $.ajax({
                                url: '/merchant/add_store_notice',
                                type: 'POST',
                                data: {content: content},
                                dataType: 'json',
                                success: function(res) {
                                    layer.close(loadIndex);
                                    if (res.code == 200) {
                                        layer.msg('添加成功', {icon: 1});
                                        table.reload('noticeTable'); // 刷新表格
                                        layer.close(index); // 关闭弹窗
                                    } else {
                                        layer.msg(res.msg || '添加失败', {icon: 2});
                                    }
                                },
                                error: function() {
                                    layer.close(loadIndex);
                                    layer.msg('网络错误，请稍后再试', {icon: 2});
                                }
                            });
                        }
                    });
                },


            })
     

        // 监听表格工具事件
        table.on('tool(noticeTable)', function (obj) {
            var data = obj.data;

            switch (obj.event) {
                case 'delete':
                    layer.confirm('确定要删除这条公告吗？', {
                        title: '提示',
                        icon: 3,
                        btn: ['确定', '取消'],
                    }, function(index) {
                        // 显示加载中
                        var loadIndex = layer.load(2);
                        
                        // 提交删除请求
                        $.ajax({
                            url: '/merchant/delete_store_notice',
                            type: 'POST',
                            data: {id: data.id},
                            dataType: 'json',
                            success: function(res) {
                                layer.close(loadIndex);
                                if (res.code == 200) {
                                    layer.msg('删除成功', {icon: 1});
                                    table.reload('noticeTable'); // 刷新表格
                                } else {
                                    layer.msg(res.msg || '删除失败', {icon: 2});
                                }
                            },
                            error: function() {
                                layer.close(loadIndex);
                                layer.msg('网络错误，请稍后再试', {icon: 2});
                            }
                        });
                        
                        layer.close(index);
                    });
                    break;
            }
        });
    });
</script>
>
</html>